package cn.itcast.bos.service.base.impl;

import java.util.Set;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.itcast.bos.dao.base.AreaRepository;
import cn.itcast.bos.domain.base.Area;
import cn.itcast.bos.service.base.AreaService;
@Service
@Transactional
public class AreaServiceImpl implements AreaService {
	
	@Autowired
	private AreaRepository areaRepository;
	
	@Override
	public void batchImport(Set<Area> set) {
		for (Area area : set) {
			areaRepository.save(area);
		}
	}

	@Override
	public Page<Area> pageQuery(Specification<Area> specification,Pageable pageable) {
		return areaRepository.findAll(specification,pageable);
	}

	@Override
	public Set<Area> findAll() {
		// TODO Auto-generated method stub
		return (Set<Area>) areaRepository.findAll();
	}
}
